package com.jiangyg.mall.gateway.support.feign;

import org.springframework.http.server.reactive.ServerHttpRequest;

/**
 * 类描述：请求上下文
 *
 * @author jiangyg
 * @version 4.0
 * @date 2022-10-13
 */
public class FeignRequestHolder {

    private static final ThreadLocal<ServerHttpRequest> holder = new InheritableThreadLocal<>();

    public static void set(ServerHttpRequest request) {
        holder.set(request);
    }

    public static ServerHttpRequest get() {
        return holder.get();
    }

    public static void clear() {
        holder.remove();
    }

}
